#ifndef WPOLYGONS_H
#define WPOLYGONS_H
#include <string>
#include <vector>
#include <iostream>


using std::cout;
using std::endl;
using std::vector;
using std::string;



#include "highfive/H5File.hpp"
using namespace HighFive;

#include "gdal_priv.h"
#include "wshppolygon.h"

struct CellLines
{
    int cellindex ;
    vector<WShpLineSeg> linesegments ;
};

struct CellHSegs
{
    int cellindex ;
    vector<WHoriLineSeg> hsegments;
} ;


class WPolygons
{
    public:
        WPolygons();
        virtual ~WPolygons();

        //1. init the object , read data from hdf file.
        bool initFromFile(string hdfFilename ) ;

        //2. after read data from hdf file, build all line segments from each cell.
        bool buildCellLines( vector<CellLines>& ret_cells ) ;

        inline bool isOk() { return _isOk; }
        inline vector<float>& getWaterSurface(){return _waterSurface;}
        inline int getWaterSurfaceXSize(){return _waterSurfaceXSize;}
        inline int getWaterSurfaceYSize(){return _waterSurfaceYSize;}
        inline vector<string>& getTimeDateVec(){return _timeDateVec;}
    protected:

        bool _isOk ;
        vector<double> _cellsCenterCoorVec ;//1280x2
        vector<double> _facePointsCoorVec ;//1212x2
        vector<int> _cellsFacePointsIndexVec ;//1280x5
        vector<float> _waterSurface ;//199x1290
        vector<string> _timeDateVec;//199

        int _waterSurfaceXSize, _waterSurfaceYSize ;

};


#endif // WPOLYGONS_H
